package net.jforum.view.forum;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

import net.jforum.Command;
import net.jforum.entities.Forum;
import net.jforum.entities.Topic;
import net.jforum.repository.ForumRepository;
import net.jforum.repository.SummaryRepository;
import net.jforum.repository.TopicRepository;
import net.jforum.util.preferences.ConfigKeys;
import net.jforum.util.preferences.SystemGlobals;
import net.jforum.util.preferences.TemplateKeys;
import net.jforum.view.forum.common.TopicsCommon;

/**
 * @ author  张洋 jackson.zhang@ericsson.com
 * @ version 创建时间 ：Sep 30, 2010  8:57:42 PM
 * @ description : 
 */
public class HomePageAction extends Command{

	 private List kuTopicsFroums;
	 private List recentTopicsForums;
	 private List topicsByPublishTimeForums;
	public void list() {
		this.setTemplateName(TemplateKeys.HOME_PAGE);
		int size=SystemGlobals.getIntValue(ConfigKeys.HOMEPAGE_TOPICS_DISPLAY_COUNT);
		
        List kuTopics=TopicRepository.getCachedKuTopicsByLimit(0, size);
        this.context.put("kuTopics", kuTopics);
        
        List recentTopics=TopicRepository.getRecentTopicsByLimit(0, size);
        this.context.put("recentTopics", recentTopics);
        
        List topicsByPublishTime=TopicRepository.getAllCachedTopicsByPublishTimeByLimit(0, size);
        this.context.put("topicsByPublishTime", topicsByPublishTime);
        
        List topicsWeeklyHot=SummaryRepository.getWeeklyTopicsByViewsByLimist(size);
        this.context.put("topicsWeeklyHot", topicsWeeklyHot);
        
 	}
	


}
